package com.config.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Argument;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

import com.constrant.RabbitMQConstant;

@Target({ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@RabbitListener(
    bindings = @QueueBinding(
        value = @Queue,
        exchange = @Exchange(value = RabbitMQConstant.DEFAULT_EXCHANGE,type = ExchangeTypes.TOPIC,
            durable = RabbitMQConstant.FALSE_CONSTANT, autoDelete = RabbitMQConstant.TURE_CONSTANT),
        key = RabbitMQConstant.DEFAULT_KEY,
        ignoreDeclarationExceptions = "true",
        arguments = @Argument(name = "x-message-ttl", value = "10000", type = "java.lang.Integer")
    )
)
public @interface MyListener {

}
